<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Final//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
<TITLE>Palette Property</TITLE>
<link rel="stylesheet" type="text/css" href="help.css">
</HEAD>

<BODY BGCOLOR="#FFFFFF" TEXT="#000000">

<OBJECT TYPE="application/x-oleobject" CLASSID="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
	<PARAM NAME="Keyword" VALUE="Palette Property">
</OBJECT>

<H1><A NAME="palette_property"></A><B>Palette Property</B></H1>
<HR>

<H2 class="AppliesTo">Applies to</H2>

<P><A HREF="thtmlviewer_component.htm">THtmlViewer</A>, <A HREF="tframeviewer_component.htm">TFrameViewer</A>, and <A HREF="tframebrowser_component.htm">TFrameBrowser</A> components</P>

<P>De<B>claration</B></P>

<P><B>property</B> Palette: HPalette;</P>

<H2 class="Description">Description</H2>

<P>In order to best display many images each of which may have its own palette, the THtmlViewer component normally color dithers each image to a compromise rainbow palette.  The Palette property allows the user to access this palette or to change it.</P>

<P>A common reason for wishing to change the palette is when the user has complete control of all the images to be displayed and the images all use the same palette.</P>

<P><B>Usage Notes</B></P>

<P>The Palette property has no effect in modes other than 256 color mode.</P>

<P>Palettes are copied when read or written.</P>

<H2 class="Example">Example</H2>

<P>Assume that all images will use a common palette.  The following shows code in the form's OnCreate event handler which uses the palette from one of those images to change THtmlViewer's palette.</P>

<P>procedure TForm1.FormCreate(Sender: TObject);</P>

<P>var</P>

<P>Bitmap: TBitmap;</P>

<P>begin</P>

<P>Bitmap := TBitmap.Create;</P>

<P>{Load a bitmap that has the common palette}</P>

<P>Bitmap.LoadFromFile(ExtractFilePath(ParamStr(0))+'myimage.bmp');</P>

<P>{Replace the palette with the common palette}</P>

<P>Viewer.Palette := Bitmap.Palette;</P>

<P>Bitmap.Free;</P>

<P>{no need to dither the images now}</P>

<P>Viewer.<A HREF="dither_property.htm">Dither</A> := False;</P>

<P>end;</P>

<P><B>See Also</B></P>

<P><A HREF="dither_property.htm">Dither property</A></P>

</BODY>
</HTML>
